package com.example.famhealing.schedule;

import java.util.ArrayList;

import com.example.famhealing.R;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ListView;

public class MeditationFragment extends Fragment {

	ImageButton addMeditation;
	
	private ArrayList<Meditation_List_Data> Array_Data;
    private Meditation_List_Data data;
    private MeditationListAdapter adapter;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		View v = inflater.inflate(R.layout.fragment_meditation, container, false);
		
		addMeditation = (ImageButton)v.findViewById(R.id.addMeditation);
		addMeditation.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(), AddMeditationActivity.class);
				startActivity(intent);
			}
			
		});
		
		Array_Data = new ArrayList<Meditation_List_Data>();
        data = new Meditation_List_Data("약", "09:00", "항암");
        Array_Data.add(data);
        data = new Meditation_List_Data("19:00", "항암", "삼성병원");
        Array_Data.add(data);
        data = new Meditation_List_Data("09:00", "항암", "세브란스 병원");
        Array_Data.add(data);
       
        ListView meditation_list = (ListView) v.findViewById(R.id.meditation_List);
        adapter = new MeditationListAdapter(getActivity(), android.R.layout.simple_list_item_1, Array_Data);
        meditation_list.setAdapter(adapter);
		
		return v;
	}
}
